import { defineStore } from 'pinia'

export const useToolsStore = defineStore('tools', {
  state: () => ({
    activeTool: null,
    measureResults: [],
    drawFeatures: [],
    trajectoryData: [],
    isPlaying: false,
    currentSpeed: 1
  }),

  getters: {
    hasActiveTool: (state) => state.activeTool !== null,
    getMeasureResults: (state) => state.measureResults,
    getDrawFeatures: (state) => state.drawFeatures
  },

  actions: {
    setActiveTool(tool) {
      this.activeTool = tool
    },
    
    clearActiveTool() {
      this.activeTool = null
    },
    
    addMeasureResult(result) {
      this.measureResults.push(result)
    },
    
    clearMeasureResults() {
      this.measureResults = []
    },
    
    addDrawFeature(feature) {
      this.drawFeatures.push(feature)
    },
    
    clearDrawFeatures() {
      this.drawFeatures = []
    },
    
    setTrajectoryData(data) {
      this.trajectoryData = data
    },
    
    setPlaying(status) {
      this.isPlaying = status
    },
    
    setSpeed(speed) {
      this.currentSpeed = speed
    }
  }
}) 